package com.etc.controller;

import com.etc.entity.User;
import com.etc.service.impl.UserServicelmpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.List;

/**
 * @Author kalista
 * @Description
 * @Date 2021/1/3  16:45
 **/
@Controller
@RequestMapping("/index")
public class lianxiController {
    @Autowired
    private UserServicelmpl userServicelmpl;

    @GetMapping("/index")
    public String index(ModelMap map) {
        map.put("hello", "wxc");
        map.put("html", "<h1>死给给</h1>");
        User user = new User();
        user.setUsername("xdd");
        user.setPassword("123456");
        user.setPhoto("001");
        user.setTelephone("654321");
        user.setUClass("2");
        map.put("user", user);
        List<User> all = userServicelmpl.finduser();
        map.put("users", all);

        HashMap<Object, Object> map1 = new HashMap<>();
        map1.put("1", "11");
        map1.put("2", "22");
        map1.put("3", "33");
        map.put("map", map1);
        int[] array = {1, 2, 3, 4, 5, 6};
        map.put("array",array);
        return "index";
    }

    @GetMapping("/tologin")
    public String tologin(int uId) {
        System.out.println(uId);
        return "login";
    }


}